package com.hotel.api.mapper;

import com.hotel.api.entity.Room;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface RoomMapper {

    List<Room> selectUserRooms();

    List<Room> selectUserRoomsByRoomNum(Integer rid);

    //增加宿舍信息
    int insert(Room record);

    //查找所有房间
    public List<Room> selectAll();

    //按照几人间查找相关房间
    public List<Room> selectRoomByTypeRoom(Integer type);

    //按照宿舍号查找房间
    public Room selectRoomByRoomNumber(int room_number);

    //按照宿舍号查找房间和人员
    public List<Room> selectNameByRoomNumber(int room_number);

    //按照归属企业查找房间
    public List<Room> selectRoomByCompany(String company);

    //根据宿舍号删除数据
    public int deleteRoomByRoomNumber(Integer rid);

    int updateRoomInfoById(Room room);


    //更新房间类型
    public int updateRoomByType(Room room);

    //换宿
    public int updateLivePeopleNumberAddByRoom(int roomNumber);

    //退宿
    public int updateLivePeopleNumberReduceByRoom(int roomNumber);

    //更新照片
    public int updateRoomByPhoto(String photo, int roomNumber);

    //更新宿舍归属企业
    public int updateRoomByCompany(String company, int roomNumber);


    public int selectRoomByNameAndIdCard(String name, String idCard);

    //管理员查找还有空床位的房间
    public List<Room> selectEntryRoom();


    //管理员按照类型查找还有空床位的房间
    public List<Room> selectEntryRoomByType(int type);

    int addRoomNumber(Integer roomNum);

    int reduceRoomNumber(Integer roomNum);

}